import { Injectable } from "@angular/core";
import { Store, State, ActionBind } from "../../../../adep/flux";
import { BankChartActionType } from "./bank-chart.action";
import { BankChartContentModel } from "./bank-chart.entity";

export interface BankChartState extends State {
    contents: BankChartContentModel[][];
    showChats: BankChartContentModel[];
}

@Injectable()
export class BankChartStore extends Store<BankChartState> {

    constructor() {
        super();

        this.state = {
            contents: [],
            showChats: []
        };
    }

    @ActionBind(BankChartActionType.REQUEST_DATA)
    private requestData(response: any) {
        this.state.contents[response.pageIndex] = response.data as BankChartContentModel[];
    }
}